package org.devf.fork.imsimulator.socket.dto;


/**
 * 消息状态
 */
public enum  MsgStatus {


    INSTANT(0,"发送中..."),
    GATEWAY_RECEIVED(1,"(已发送)"),
    GATEWAY_DISPATCHER(2,"已转发(未读)"),
    DEST_READ(3,"已读"),
    NOTIFY_DEST_READ(4,"通知消息已被读"),
    ERROR_MESSAGE(10,"消息格式异常");

    private Integer code;

    private String desc;


    MsgStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public String getDesc() {
        return desc;
    }

    public Integer getCode() {
        return code;
    }

    public static MsgStatus getByCode(Integer code){
        for (MsgStatus value : values()) {
            if (value.code.equals(code)){
                return value;
            }
        }
        return ERROR_MESSAGE;
    }
}
